package com.hangim.pce.common.search.domain;


import com.hangim.pce.common.search.enums.ESActionType;
import com.hangim.pce.common.search.enums.ESEntityType;

import java.io.Serializable;

// ElasticSearch 发送消息队列的负载对象，携带消息动作，ES对象和对象类型
public class ESPayLoad<T extends ESIdEntity> implements Serializable {
    // ES对象，保存在 ElasticSearch 的索引中的数据
    private T entity;
    // 消息动作，ElasticSearch 目前需要发的消息主要有同步数据和删除数据两种动作
    private ESActionType action;
    // 对象类型，即用于描述ES对象的类型
    private ESEntityType type;

    public ESPayLoad() {
    }

    public ESPayLoad(T entity, ESActionType action, ESEntityType type) {
        this.entity = entity;
        this.action = action;
        this.type = type;
    }

    public T getEntity() {
        return entity;
    }

    public void setEntity(T entity) {
        this.entity = entity;
    }

    public ESActionType getAction() {
        return action;
    }

    public void setAction(ESActionType action) {
        this.action = action;
    }

    public ESEntityType getType() {
        return type;
    }

    public void setType(ESEntityType type) {
        this.type = type;
    }
}
